package com.hk.blog.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.hk.core.data.jpa.domain.AbstractSnowflakeAuditable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

@Data
@Entity
@Accessors(chain = true)
@Table(name = "t_user_info")
@EqualsAndHashCode(callSuper = true)
public class UserInfo extends AbstractSnowflakeAuditable {

    @Column(name = "username", updatable = false, unique = true)
    private String username;

    private String nickName;

    private Byte gender;

    @Column(name = "mobile_number", unique = true)
    private String mobileNumber;

    private Byte userType;

    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    private Byte userStatus;

    private String email;

    private String iconPath;

    private String remark;

    public LocalDateTime getCreatedTime() {
        return super.getCreatedDate().get();
    }
}
